﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using Bll;
using Newtonsoft.Json;
namespace WebApiServer.Controllers
{
    public class ToMenuController : ApiController
    {

        ToMenuBLL bll = new ToMenuBLL();
        #region 今日推荐显示
        [HttpPost]
        /// <summary>
        /// 今日推荐显示
        /// </summary>
     
        /// <returns></returns>
        public string PostToMenushow()
        {
            ReMenuToMenu mo = new ReMenuToMenu();
            ReMenuBLL bll1=new ReMenuBLL();
            mo.PostReMenushow = bll1.ReMenushow();
            mo.PostToMenushow = bll.ToMenushow();
            return JsonConvert.SerializeObject(mo);

        }
        #endregion

        #region 显示菜单
        public List<ToMenu> GetToshow()
        {
            return bll.ToMenushow();    
        }
        #endregion

        #region 添加今日推荐
        //添加今日推荐
        public int GetAddToMenu(int Toid, string Toname, string Tophoto, string Todescrib, int Toprice)
        {
            if (bll.AddToMenu(Toid, Toname, Tophoto, Todescrib, Toprice) > 0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
        #endregion

        #region 删除今日推荐
        /// <summary>
        /// 删除今日推荐
        /// </summary>
        /// <returns></returns>
        public int GetdelToMenu()
        {
            return bll.delToMenu();
        }
        #endregion

    }
}
